package cn.amarone.controller;

import cn.amarone.mapper.UserMapper;
import cn.amarone.model.User;
import com.baomidou.mybatisplus.extension.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserCenterController {
    @Autowired
    private UserMapper userMapper;


    @GetMapping("u")
    @PreAuthorize("hasAuthority('test')")
    public String queryUser(){
        return "user";
    }

    @GetMapping("/userInfo")
    @PreAuthorize("hasAuthority('system:dept:list')")
    public R queryOne(){
        User user = userMapper.selectById(1);
        return R.ok(user);
    }
}
